"""
登录框
"""

import tkinter as tk
from tkinter import messagebox

# 登录验证
def chekc_login():
    username = enter_username.get()
    password = enter_password.get()
    
    if username == "admin" and password == "123456":
        messagebox.showinfo("登录成功", "欢迎进入系统")
    else:
        messagebox.showerror("登录失败", "用户名或密码错误")


# 创建窗口
root = tk.Tk()
root.title("用户登陆")
root.geometry("400x400+1000+100")

# 创建用户输入
tk.Label(root, text="用户名:").grid(row=0,column=0)
enter_username = tk.Entry(root)
enter_username.grid(row=0,column=1)

# 创建密码输入
tk.Label(root, text="密码:").grid(row=1,column=0)
enter_password = tk.Entry(root, show="*")
enter_password.grid(row=1,column=1)


login_btn = tk.Button(root, text="登陆", command=chekc_login)
login_btn.grid(row=2,columnspan=2, pady=10)

root.mainloop()